<template>
  <div v-loading="loading">

  </div>
</template>

<script>


import router from "@/router";

export default {
  name: "adminLogin",
  data(){
    return {
      key: '',
      jumpInfo: '',
      info: '',
      loading: false,
    }
  },
  created() {
    this.key = this.$route.query.key
    this.jumpInfo = this.$route.query.jumpInfo
    this.info = this.$route.query.info
    if(!this.key){
      this.$errorMessage('缺少参数')
      window.close()
      return;
    }
    this.getToken()
  },
  methods:{
    getToken(){
      this.loading = true
      this.$store.dispatch('user/adminLogin',this.key)
        .then(res=>{
          this.loading = false;
          // console.log(this.jumpInfo)
          // return false
          if (this.jumpInfo === 'uploadShipmentInfo') {
            this.$router.push({
              name: 'uploadShipmentInfo',
              query: {
                id: this.info
              }
            })
          } else if (this.jumpInfo === 'uploadSheinImageInfo') {
            this.$router.push({
              name: 'uploadSheinImageInfo',
              query: {
                id: this.info
              }
            })
          } else {
            this.$router.replace({ path: '/' })
          }
        })
    }
  }
}
</script>

<style scoped lang="scss">

</style>
